package com.kabuda.blog.controller;

import com.kabuda.blog.service.IArticleService;
import com.kabuda.blog.vo.ArticleVo;
import com.kabuda.blog.vo.Result;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.List;

/**
 * @author kabuda
 * @create 2023-04-04 21:32
 */
@Api(tags = "文章接口")
@RestController
@RequestMapping("/article")
public class ArticleController {
    @Autowired
    private IArticleService articleService;

    @ApiOperation("文章列表")
    @GetMapping("/list")
    public Result list(){
       List<ArticleVo> articleVos= articleService.listVo();
       return Result.success(articleVos);
    }
    @ApiOperation("删除文章")
    @GetMapping("/delete")
    public Result delete(@RequestParam("id")Long ArticleId){
        this.articleService.deleteArticle(ArticleId);
       return Result.success(null);
    }
}
